<@c.html title="用户列表">
<script type="text/javascript">	
    var gridOptions = {
		<#include "/WEB-INF/ftl/common/privilege.ftl" />
    	url : 'sys-user!flexigrid.action',
		dataType : 'json',
		colModel : [
			{display: '用户ID', name : 'userid', width : 90, sortable : false, align: 'center'},
			{display: '登陆IP', name : 'loginip', width : 180, sortable : true, align: 'left'},
			{display: '用户名', name : 'username', width : 120, sortable : true, align: 'left'},
			{display: '登陆时间', name : 'logintime', width : 80, sortable : true, align: 'left', hide: true},
			{display: '在线标志', name : 'onlineflag', width : 80, sortable : true, align: 'right'}
			],
		searchitems : [
			{display: '用户ID', name : 'filter_userid'},
			{display: '用户名', name : 'filter_username', isdefault: true}
			],
		sortname: "userid",
		rowdbclick: userDetail,
		sortorder: "desc",
		usepager: true,
		title: '用户列表',
		useRp: true,
		rp: 15,
		showTableToggleBtn: true,
		width: 700,
		height: 200
	};
	    
    var formOptions = { 
        target      : "#flex-user", 
        beforeSubmit: _validForm,  
        success     : returnbind, 
        url         : 'sys-user!ajaxSave.action',
        type        : 'post',
        dataType    : 'json',
        clearForm   : true,
        resetForm   : false,
         
        timeout     : 3000,
        error       : writeMsg 
    }; 

	$(document).ready(function(){
	    $("#flex-user").flexigrid(gridOptions);
	});   

	function submitbind(){    
	    $("#valid_form_user").submit(function(){
	        $(this).ajaxSubmit(formOptions);
	        return false;
	    });	    	    
	}
	
	function returnbind(result,status){
        writeMsg(result);
        if(result.returncode == "0000"){
	        $("#flex-user").flexReload(gridOptions);
	    }
	}
	
	function writeMsg(xmlhttpRequest ,textStatus){
	    var returnmsg = textStatus;
	    var stylecolor = "red";
	    if(arguments.length == 1){
			returnmsg = xmlhttpRequest.returnmsg;
			if(xmlhttpRequest.returncode == "0000"){
			    stylecolor = "green";
			}
	    }
        var li = document.createElement("li");
        li.style.color = stylecolor;
        li.innerText = returnmsg;
    	document.getElementById("dynamicMsgDiv").appendChild(li);
	}
	
	function userDetail(event){
		var url = 'sys-user!ajaxDetail.action';
		var param = {userid: event.data.row.id};
		$.getJSON(url,param,function(data){
			showEditDialog('success','textarea-user',data);
		});
	}
</script>

<table id="flex-user" style="display:none"></table>    

<p style="display:none"><textarea id="textarea-user" rows="0" cols="0"><!--
    <form id="valid_form_user">
        <div id="dynamicMsgDiv"/>
        <table>
        {#if $T && $T.result[0]}
            <tr>
                <td>用户名</td><td><input type="text" id="userid" name="userid" value="{$T.result[0].userid}"/></td>
                <td>用户姓名</td><td><input type="text" id="username" name="username" value="{$T.result[0].username}"/></td>
            </tr>
            <tr>
                <td>性别</td><td><input type="text" id="sex" value="{$T.result[0].sex}"/></td>
                <td>出生年月</td><td><input type="text" id="birthday" value="{$T.result[0].birthday}"/></td>
            </tr>
            <tr>
                <td>手机号码</td><td><input type="text" id="mobile" value="{$T.result[0].mobile}"/></td>
                <td>电子邮件</td><td><input type="text" id="email" value="{$T.result[0].email}"/></td>
            </tr>
            <tr>
                <td>通讯地址</td><td><input type="text" id="address" value="{$T.result[0].address}"/></td>
                <td>固定电话</td><td><input type="text" id="hometel" value="{$T.result[0].hometel}"/></td>
            </tr>
            <tr>
                <td>学历</td><td><input type="text" id="education" value="{$T.result[0].education}"/></td>
                <td>公司</td><td><input type="text" id="company" value="{$T.result[0].company}"/></td>
            </tr>
            <tr>
                <td>所在城市</td><td><input type="text" id="city" value="{$T.result[0].city}"/></td>
                <td>邮政编码</td><td><input type="text" id="postcode" value="{$T.result[0].postcode}"/></td>
            </tr>
            <tr>
                <td>密码</td><td><input type="password" id="loginpassword" name="loginpassword" value="{$T.result[0].loginpassword}"/></td>
                <td>确认密码</td><td><input type="password" id="loginpassword2" value="{$T.result[0].loginpassword}"/></td>
            </tr>
        {#else}
            <tr>
                <td>用户名</td><td><input type="text" id="userid" name="userid"/></td>
                <td>用户姓名</td><td><input type="text" id="username" name="username"/></td>
            </tr>
            <tr>
                <td>性别</td><td><input type="text" id="sex"/></td>
                <td>出生年月</td><td><input type="text" id="birthday"/></td>
            </tr>
            <tr>
                <td>手机号码</td><td><input type="text" id="mobile"/></td>
                <td>电子邮件</td><td><input type="text" id="email"/></td>
            </tr>
            <tr>
                <td>通讯地址</td><td><input type="text" id="address"/></td>
                <td>固定电话</td><td><input type="text" id="hometel"/></td>
            </tr>
            <tr>
                <td>学历</td><td><input type="text" id="education"/></td>
                <td>公司</td><td><input type="text" id="company"/></td>
            </tr>
            <tr>
                <td>所在城市</td><td><input type="text" id="city"/></td>
                <td>邮政编码</td><td><input type="text" id="postcode"/></td>
            </tr>
            <tr>
                <td>密码</td><td><input type="password" id="loginpassword" name="loginpassword"/></td>
                <td>确认密码</td><td><input type="password" id="loginpassword2"/></td>
            </tr>
        {#/if}
            <tr>
                <td colspan="4"><input type="submit" value="提交"/><input type="reset" value="重置"/></td>
            </tr>
        </table>
    </form>
--></textarea></p>

</@c.html>